Repository navigation
Merge upstream - #55
Merged
Merged
Conversation
Next() previously crossed into C once to step and again to read the row's columns. Step and fetch the values in a single _sqlite3_step_values call, mirroring the fused first-step path, and keep the step output parameters on the statement instead of allocating escaping locals on every query. Saves one CGO crossing per row and one allocation per query. On the :memory: BenchmarkPreparedRows the 1000-row cases improve 7-10%; on the WAL file DB fair benchmarks (single-row QueryRow) the time is unchanged and allocations drop by one per query.
Fuse step and column fetch into one CGO crossing in Next
sqlite3_set_authorizer takes db->mutex, while query cancellation takes c.mu before calling sqlite3_interrupt. Holding c.mu across the call could block cancellation of a running query, so use authorizerMu.
…authorizers fix: release replaced authorizer callbacks
…lose SQLite dereferences the connection handle without checking it, so every *SQLiteConn method that passes c.db into the C API segfaulted once Close had released the handle and set it to nil. This is reachable from ordinary code: a connection captured from a ConnectHook outlives the *sql.DB, and calling any of these methods on it killed the process. Guard the affected methods with the existing dbConnOpen helper, which reads the handle under mu and is not held across the C call, so it does not reintroduce the lock-order inversion that RegisterAuthorizer avoids with its own mutex. Methods that return an error report errConnClosed, the callback registrations that have no error to report become no-ops, and the accessors report a documented zero value. Affected: RegisterCollation, RegisterCommitHook, RegisterRollbackHook, RegisterUpdateHook, RegisterAuthorizer, RegisterFunc, RegisterAggregator, AutoCommit, GetFilename, GetLimit, SetLimit, SetFileControlInt and SetFileControlInt64.
Return an error instead of crashing when a connection is used after Close
Since 4954048, Exec without arguments takes a fast path that steps each statement without checking its parameters, so a statement whose arguments are missing ran with them bound as NULL instead of failing with "not enough args to execute query". Leave such a statement unexecuted in that path and return the same error as the regular path. Fixes mattn#1470
…ng-params Report missing arguments when Exec has no arguments
Upgrade SQLite to version 3540100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.